In alloc_vcpu_struct, after doing a memset on the new allocated vcpu, we
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 28 Nov 2005 15:24:14 +0000 (16:24 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 28 Nov 2005 15:24:14 +0000 (16:24 +0100)
do a memcpy from idle0_vcpu.arch to arch of the new vcpu, which causes
monitor_pagetable is set to a none 0 value.  For VMX guest which is
using external shadow mode, this is not what we really need. the
previous patch is OK for UP VMX guest, but failed on SMP VMX guest.

Signed-off-by: Xin Li <xin.b.li@intel.com>
xen/arch/x86/domain.c
xen/arch/x86/vmx.c

index 7319eba244e004a0c56b305aa7482f4521abe023..54d166485cdc7014b0b683d9ffa24ed0e5411433 100644 (file)
@@ -414,9 +414,6 @@ int arch_set_info_guest(
             d->arch.phys_table = v->arch.guest_table;
         v->arch.guest_table = mk_pagetable(0);
 
-        /* Initialize monitor page table */
-        v->arch.monitor_table = mk_pagetable(0);
-
         vmx_final_setup_guest(v);
     }
 
index a61eb42fb144e5570606db7b200066771c3b4fc3..7ae4f612b618b9756adcae664103175ec0053dcd 100644 (file)
@@ -61,23 +61,30 @@ void vmx_final_setup_guest(struct vcpu *v)
 {
     v->arch.schedule_tail = arch_vmx_do_launch;
 
-    if ( v == v->domain->vcpu[0] )
+    if ( v->vcpu_id == 0 )
     {
-        v->domain->arch.vmx_platform.lapic_enable =
-            v->arch.guest_context.user_regs.ecx;
+        struct domain *d = v->domain;
+        struct vcpu *vc;
+
+        d->arch.vmx_platform.lapic_enable = v->arch.guest_context.user_regs.ecx;
         v->arch.guest_context.user_regs.ecx = 0;
         VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "lapic enable is %d.\n",
-                    v->domain->arch.vmx_platform.lapic_enable);
+                    d->arch.vmx_platform.lapic_enable);
+
+        /* Initialize monitor page table */
+        for_each_vcpu(d, vc)
+            vc->arch.monitor_table = mk_pagetable(0);
+
         /*
          * Required to do this once per domain
          * XXX todo: add a seperate function to do these.
          */
-        memset(&v->domain->shared_info->evtchn_mask[0], 0xff,
-               sizeof(v->domain->shared_info->evtchn_mask));
+        memset(&d->shared_info->evtchn_mask[0], 0xff,
+               sizeof(d->shared_info->evtchn_mask));
 
         /* Put the domain in shadow mode even though we're going to be using
          * the shared 1:1 page table initially. It shouldn't hurt */
-        shadow_mode_enable(v->domain,
+        shadow_mode_enable(d,
                            SHM_enable|SHM_refcounts|
                            SHM_translate|SHM_external|SHM_wr_pt_pte);
     }